import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductFeaturesVO, ProductFeaturesForm, ProductFeaturesQuery } from '@/api/system/productFeatures/types';

/**
 * 查询产品特性标签，存储产品的主要特性列表
 * @param query
 * @returns {*}
 */

export const listProductFeatures = (query?: ProductFeaturesQuery): AxiosPromise<ProductFeaturesVO[]> => {
  return request({
    url: '/system/productFeatures/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品特性标签，存储产品的主要特性详细
 * @param id
 */
export const getProductFeatures = (id: string | number): AxiosPromise<ProductFeaturesVO> => {
  return request({
    url: '/system/productFeatures/' + id,
    method: 'get'
  });
};

/**
 * 新增产品特性标签，存储产品的主要特性
 * @param data
 */
export const addProductFeatures = (data: ProductFeaturesForm) => {
  return request({
    url: '/system/productFeatures',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品特性标签，存储产品的主要特性
 * @param data
 */
export const updateProductFeatures = (data: ProductFeaturesForm) => {
  return request({
    url: '/system/productFeatures',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品特性标签，存储产品的主要特性
 * @param id
 */
export const delProductFeatures = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/productFeatures/' + id,
    method: 'delete'
  });
};
